SYS_NAME=test

MAINPATH=$(shell /bin/pwd)
CPROJECTPATH=$(MAINPATH)/CProject
COMMONPATH=$(MAINPATH)/Common
TESTPATH=$(MAINPATH)/TestProject
BINARY=binary

INCLUDES=-I$(CPROJECTPATH)/headers -I$(COMMONPATH)/headers
vpath %.c CProject/sources
vpath %.c $(COMMONPATH)/sources
vpath %.c TestProject/Test_files


SYSTEM_OBJECTS=$(BINARY)/Dual_Link_List.o 

UNITTEST_OBJECTS=$(BINARY)/CreateLinkListHelper.o \
				 $(BINARY)/PrintDataHelper.o \
				 $(BINARY)/test.o

SUN_STUDIO = /usr
SUN_STUDIO_PREFIX = $(SUN_STUDIO)
CFLAGS=$(INCLUDES)
CC = $(SUN_STUDIO_PREFIX)/bin/gcc
CXX = $(SUN_STUDIO_PREFIX)/bin/g++
MKDIR=mkdir

all : $(BINARY) $(SYS_NAME)

$(BINARY):
	$(MKDIR) $(BINARY)

$(SYS_NAME): $(SYSTEM_OBJECTS) $(UNITTEST_OBJECTS)
	$(CC) -o $(SYS_NAME) $(SYSTEM_OBJECTS) $(UNITTEST_OBJECTS)

$(BINARY)/%.o : %.c 
	$(CC) $(CFLAGS) -c $< -o $@

clean:
	rm -rf $(SYS_NAME) $(BINARY)
